﻿/** 无界面的情况下使用宏类的实例,使用的是CommonMacro类

  By setycyas @2023-02-04
*/

/* 全局设定
*/
#Warn
#MaxThreadsPerHotkey 1
SetWorkingDir(A_ScriptDir)
#Include "..\Class\FaceDetector.2.ahk"
#Include "..\Class\CommonMacro.2.ahk"
SendMode("Input")

/* 按键设置,使用时可修改这里设定按键
*/
;winTitle := "" ;热键生效的窗口设定,空字符串则是任何时候热键都生效
winTitle := "ahk_exe nebula.exe" ;热键生效的窗口设定,空字符串则是任何时候热键都生效
gameKeys := ["x", "e"] ;游戏按键设定
hotkeyMap := Map("w", "连发A",
  "2", "下上A",
  "q", "下前A",
  "3", "A后防御",
  "r", "下前B") ;热键与对应的宏名称设定

/* 新建实例,绑定按键
*/
face := FaceDetector(winTitle)
face.setup()
macro := CommonMacro(face, gameKeys)
if (winTitle == ""){
  for k, v in hotkeyMap {
	Hotkey(k, macro.macroMap[v])
  }
} else {
  HotIfWinActive(winTitle)
  for k, v in hotkeyMap {
	Hotkey(k, macro.macroMap[v])
  }
  HotIfWinActive()
}
